package student.aistar.design.singleton.version01;

public class Singleton01 {
    //该类中唯一的对象
    private static Singleton01 instance = new Singleton01();

    //构造方法私有化
    private Singleton01(){}

    //对外提供一个访问该对象的静态方法
    public static Singleton01 getInstance(){
        return instance;
    }
}

class Test{
    public static void main(String[] args) {
        Singleton01 s1 = Singleton01.getInstance();
        Singleton01 s2 = Singleton01.getInstance();
        System.out.println(s1);
        System.out.println(s2);
    }
}
